#include "code/inc/lcd_adapter.h"
#include "code/inc/lcd_queue.h"
#include "code/inc/lcd_protocol.h"

static struct queue queuesend;
static struct queue queuerecv;


void callback_prosend(char *buf)
{
    lcdqueue_sendmsg(&queuerecv,buf);
}

void lcdadapter_init(void )
{

    lcdqueue_init(&queuesend);
    lcdqueue_init(&queuerecv);

    protocol_init(&callback_prosend);
}
void lcdadapter_poll()
{
    protocol_poll();

    char buf[256] = {0};
    uint8 ret =  lcdqueue_recvmsg(&queuesend,buf);
    if(!ret)
    {
       return ;
    }
    protocol_dealmsg(buf);
}

uint8 lcdadapter_sendmsg(const char *buf)
{
    return lcdqueue_sendmsg(&queuesend,buf);
}
uint8 lcdadapter_recvmsg(char *buf)
{
    return lcdqueue_recvmsg(&queuerecv,buf);
}

